package com.dragon.design.pattern.creational.prototype;

/**
 * Created by geely
 */
public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {
//        Mail mail = new Mail();
//        mail.setContent("初始化模板");
//        System.out.println("初始化mail:"+mail);
//        for(int i = 0;i < 10;i++){
//            Mail mailTemp = (Mail) mail.clone();
//            mailTemp.setName("姓名"+i);
//            mailTemp.setEmailAddress("姓名"+i+"@imooc.com");
//            mailTemp.setContent("恭喜您，此次慕课网活动中奖了");
//            MailUtil.sendMail(mailTemp);
//            System.out.println("克隆的mailTemp:"+mailTemp);
//        }
//        MailUtil.saveOriginMailRecord(mail);
//        C c = new C();
//        c.setName("dragon");
//        System.out.println(c);
//        System.out.println("c name:" + c.getName());
//        C newC = c.getCloneInstance();
//        System.out.println(newC);
//        newC.setName("mars");
//        System.out.println("newC name:" + newC.getName());

//        C c = new C();
//        c.setName("dragon");
//        E e = new E();
//        e.setName("e dragon");
//        F f = new F();
//        f.setAge(10);
//        f.setClassName("f classroom");
//        e.setF(f);
//
//        c.setName("c dragon");
//        c.setE(e);
//        System.out.println("c" + c);
//        C newC = c.getCloneInstance();
//        System.out.println("newC:" + newC);
//        c.getE().setName("e dragon 123");
//        c.getE().getF().setClassName("f classroom1");
//        System.out.println("newC:" + newC);

        C c = new C();
        c.setE(new E());
        C newC = (C) c.clone();
        System.out.println("c:" + c);
        System.out.println("newC:" + newC);
    }
}
